<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>axipmon: xaxipmon_ocm_example.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="HTML_custom.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="xlogo_bg.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">axipmon
   </div>
   <div id="projectbrief">Vitis Drivers API Documentation</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Overview</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="globals.html"><span>APIs</span></a></li>
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="pages.html"><span>Examples</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('xaxipmon__ocm__example_8c.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">xaxipmon_ocm_example.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Overview</h2>
<div class="textblock"><p>This file contains a design example showing how to use the driver APIs of the AXI Performance Monitor driver to measure the following metrics captured at OCM of Zynq MP: </p>
<pre class="fragment">  - Write Transcation Count
  - Write Byte Count
  - Read Transcation Count
  - Read Byte Count
</pre><pre></pre><pre>MODIFICATION HISTORY:</pre><pre>Ver   Who    Date     Changes
</p>
<hr/>
<p>
1.00a bss    04/01/15 First release
6.5   sg     11/02/16 Updated device ID to OCM PSU APM ID
      ms     01/23/17 Modified xil_printf statement in main function to
                      ensure that "Successfully ran" and "Failed" strings are
                      available in all examples. This is a fix for CR-965028.
6.10  ht     06/23/23 Added support for system device-tree flow.
</pre> </div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:affabe0f236da72ce614eb1327a0663d3"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xaxipmon__ocm__example_8c.html#affabe0f236da72ce614eb1327a0663d3">ApmCheck</a> (u32 *BufferPtr, u16 Wtx, u16 Wbc, u16 Rtx, u16 Rbc)</td></tr>
<tr class="memdesc:affabe0f236da72ce614eb1327a0663d3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Checks the metrics passed to this function are same as collected by APM.  <a href="#affabe0f236da72ce614eb1327a0663d3">More...</a><br/></td></tr>
<tr class="separator:affabe0f236da72ce614eb1327a0663d3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1b57d7ae6147dd7eeae26ff6de9bffaf"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xaxipmon__ocm__example_8c.html#a1b57d7ae6147dd7eeae26ff6de9bffaf">OcmTransaction</a> ()</td></tr>
<tr class="memdesc:a1b57d7ae6147dd7eeae26ff6de9bffaf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Generates write and read transcations to OCM and reads metrics captured by APM.  <a href="#a1b57d7ae6147dd7eeae26ff6de9bffaf">More...</a><br/></td></tr>
<tr class="separator:a1b57d7ae6147dd7eeae26ff6de9bffaf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a45f2fc789f580be3954954245bb05427"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xaxipmon__ocm__example_8c.html#a45f2fc789f580be3954954245bb05427">ApmMetricConfig</a> (<a class="el" href="struct_x_axi_pmon.html">XAxiPmon</a> *InstancePtr, u8 slot, u8 Metric1, u8 Metric2)</td></tr>
<tr class="memdesc:a45f2fc789f580be3954954245bb05427"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets Counter 0 and Counter 1 for collecting the passed metrics.  <a href="#a45f2fc789f580be3954954245bb05427">More...</a><br/></td></tr>
<tr class="separator:a45f2fc789f580be3954954245bb05427"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a33a055205e1207383072c902f6e8bee1"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xaxipmon__ocm__example_8c.html#a33a055205e1207383072c902f6e8bee1">ReadMetrics</a> (<a class="el" href="struct_x_axi_pmon.html">XAxiPmon</a> *InstancePtr, u32 *BufferPtr, u8 Counter1, u8 Counter2)</td></tr>
<tr class="memdesc:a33a055205e1207383072c902f6e8bee1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reads metrics from APM counters to buffer.  <a href="#a33a055205e1207383072c902f6e8bee1">More...</a><br/></td></tr>
<tr class="separator:a33a055205e1207383072c902f6e8bee1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a840291bc02cba5474a4cb46a9b9566fe"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xaxipmon__ocm__example_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main</a> (void)</td></tr>
<tr class="memdesc:a840291bc02cba5474a4cb46a9b9566fe"><td class="mdescLeft">&#160;</td><td class="mdescRight">Main function that invokes the example in this file.  <a href="#a840291bc02cba5474a4cb46a9b9566fe">More...</a><br/></td></tr>
<tr class="separator:a840291bc02cba5474a4cb46a9b9566fe"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="affabe0f236da72ce614eb1327a0663d3"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ApmCheck </td>
          <td>(</td>
          <td class="paramtype">u32 *&#160;</td>
          <td class="paramname"><em>BufferPtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u16&#160;</td>
          <td class="paramname"><em>Wtx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u16&#160;</td>
          <td class="paramname"><em>Wbc</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u16&#160;</td>
          <td class="paramname"><em>Rtx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u16&#160;</td>
          <td class="paramname"><em>Rbc</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Checks the metrics passed to this function are same as collected by APM. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">BufferPtr</td><td>is pointer to buffer containing captured metrics. </td></tr>
    <tr><td class="paramname">Wtx</td><td>is Write transaction count value to be checked. </td></tr>
    <tr><td class="paramname">Wbc</td><td>is Write byte count value to be checked. </td></tr>
    <tr><td class="paramname">Rtx</td><td>is Read transaction count value to be checked. </td></tr>
    <tr><td class="paramname">Rbc</td><td>is Read byte count value to be checked.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li>XST_SUCCESS if metrics passed are equal to metrics collected by APM.</li>
<li>XST_FAILURE if any of the metrics passed is not equal to metrics collected by APM.</li>
</ul>
</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p>Referenced by <a class="el" href="xaxipmon__ocm__example_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main()</a>.</p>

</div>
</div>
<a class="anchor" id="a45f2fc789f580be3954954245bb05427"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ApmMetricConfig </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_x_axi_pmon.html">XAxiPmon</a> *&#160;</td>
          <td class="paramname"><em>InstancePtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8&#160;</td>
          <td class="paramname"><em>slot</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8&#160;</td>
          <td class="paramname"><em>Metric1</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8&#160;</td>
          <td class="paramname"><em>Metric2</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Sets Counter 0 and Counter 1 for collecting the passed metrics. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">InstancePtr</td><td>is pointer to APM instance. </td></tr>
    <tr><td class="paramname">Slot</td><td>is APM slot. </td></tr>
    <tr><td class="paramname">Metric1</td><td>is Metric to be captured by Counter 1 </td></tr>
    <tr><td class="paramname">Metric2</td><td>is Metric to be captured by Counter 2</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li>XST_SUCCESS on success.</li>
<li>XST_FAILURE on failure.</li>
</ul>
</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p>References <a class="el" href="group__axipmon.html#ga1f34457ef45ca60383e42a52d173d498">XAPM_METRIC_COUNTER_0</a>, <a class="el" href="group__axipmon.html#gad5defe9c4e3649b5b8c6016cabea6fe7">XAPM_METRIC_COUNTER_1</a>, <a class="el" href="group__axipmon.html#ga12595840082105ce722b8b36d910443a">XAxiPmon_EnableMetricsCounter()</a>, <a class="el" href="group__axipmon.html#ga25191e9280ab4a1dcffae7afd08ae599">XAxiPmon_ResetGlobalClkCounter()</a>, <a class="el" href="group__axipmon.html#ga34106e1380f932cb94c74e1bea3a34b3">XAxiPmon_ResetMetricCounter()</a>, <a class="el" href="group__axipmon.html#gaa14a3b36f2558ecbc47d81d4b3c3fd9d">XAxiPmon_SetMetrics()</a>, and <a class="el" href="group__axipmon.html#ga086eebc115587aab4f5613ed99a28314">XAxiPmon_StartCounters()</a>.</p>

<p>Referenced by <a class="el" href="xaxipmon__ocm__example_8c.html#a1b57d7ae6147dd7eeae26ff6de9bffaf">OcmTransaction()</a>.</p>

</div>
</div>
<a class="anchor" id="a840291bc02cba5474a4cb46a9b9566fe"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int main </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Main function that invokes the example in this file. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">None.</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li>XST_SUCCESS if the example has completed successfully.</li>
<li>XST_FAILURE if the example has failed.</li>
</ul>
</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p>References <a class="el" href="xaxipmon__ocm__example_8c.html#affabe0f236da72ce614eb1327a0663d3">ApmCheck()</a>, <a class="el" href="struct_x_axi_pmon___config.html#aaaf3e726cc3af1648c88b8a3052252db">XAxiPmon_Config::BaseAddress</a>, <a class="el" href="xaxipmon__ocm__example_8c.html#a1b57d7ae6147dd7eeae26ff6de9bffaf">OcmTransaction()</a>, <a class="el" href="group__axipmon.html#gafc3c070e08d80f970b4e84c74ca6b37e">XAxiPmon_CfgInitialize()</a>, <a class="el" href="group__axipmon.html#ga339b500e3f165daf5b7b8f943eee0437">XAxiPmon_DisableMetricsCounter()</a>, and <a class="el" href="group__axipmon.html#ga93ed0a2b99a2e74dc0da62ed674fd2bb">XAxiPmon_LookupConfig()</a>.</p>

</div>
</div>
<a class="anchor" id="a1b57d7ae6147dd7eeae26ff6de9bffaf"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void OcmTransaction </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Generates write and read transcations to OCM and reads metrics captured by APM. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">None.</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p>References <a class="el" href="xaxipmon__ocm__example_8c.html#a45f2fc789f580be3954954245bb05427">ApmMetricConfig()</a>, <a class="el" href="xaxipmon__ocm__example_8c.html#a33a055205e1207383072c902f6e8bee1">ReadMetrics()</a>, <a class="el" href="group__axipmon.html#ga1f34457ef45ca60383e42a52d173d498">XAPM_METRIC_COUNTER_0</a>, <a class="el" href="group__axipmon.html#gad5defe9c4e3649b5b8c6016cabea6fe7">XAPM_METRIC_COUNTER_1</a>, <a class="el" href="group__axipmon.html#ga345d7613d04158d0c726d87020dc9d46">XAPM_METRIC_SET_0</a>, <a class="el" href="group__axipmon.html#ga735a85df6ce7d834e9471e302d0bc208">XAPM_METRIC_SET_1</a>, <a class="el" href="group__axipmon.html#ga010e12c93f6988991c9d1982b74c5f84">XAPM_METRIC_SET_2</a>, and <a class="el" href="group__axipmon.html#ga9108e3537c68814feed6dda8105f0691">XAPM_METRIC_SET_3</a>.</p>

<p>Referenced by <a class="el" href="xaxipmon__ocm__example_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main()</a>.</p>

</div>
</div>
<a class="anchor" id="a33a055205e1207383072c902f6e8bee1"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ReadMetrics </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_x_axi_pmon.html">XAxiPmon</a> *&#160;</td>
          <td class="paramname"><em>InstancePtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32 *&#160;</td>
          <td class="paramname"><em>BufferPtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8&#160;</td>
          <td class="paramname"><em>Counter1</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8&#160;</td>
          <td class="paramname"><em>Counter2</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Reads metrics from APM counters to buffer. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">InstancePtr</td><td>is pointer to APM instance. </td></tr>
    <tr><td class="paramname">BufferPtr</td><td>is pointer to buffer. </td></tr>
    <tr><td class="paramname">Counter1</td><td>is counter number. </td></tr>
    <tr><td class="paramname">Counter2</td><td>is counter number.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p>References <a class="el" href="group__axipmon.html#ga5450238f0ff52df5a447c26199e9dd4d">XAxiPmon_GetMetricCounter()</a>, and <a class="el" href="group__axipmon.html#ga700e821cca7fea12dfe83c0364d3ec90">XAxiPmon_StopCounters()</a>.</p>

<p>Referenced by <a class="el" href="xaxipmon__ocm__example_8c.html#a1b57d7ae6147dd7eeae26ff6de9bffaf">OcmTransaction()</a>.</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
	<p class="footer">&copy; Copyright 2015-2022 Xilinx, Inc. All Rights Reserved.</p>
	<p class="footer">&copy; Copyright 2022-2023 Advanced Micro Devices, Inc. All Rights Reserved.</p>
</div>
</body>
</html>
